package com.butte.mound.frame.entity;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@ApiModel(value = "分页查询")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageDTO {

    @ApiModelProperty(value = "当前页", example = "1")
    @Valid
    @NotNull(message = "当前页必填")
    private Integer current;

    @Valid
    @NotNull(message = "分页大小必填")
    @ApiModelProperty(value = "分页大小", example = "10")
    private Integer size;

    public <T> IPage<T> toPage() {
        return new Page<T>(current, size);
    }
}